<?php
	if(isset($_GET['mlh']) && trim($_GET['mlh']) != "0" && trim($_GET['mlh']) != "")
	{
		$MaLopHoc = strtoupper(trim($_GET['mlh']));
		include_once '../classes/lophoc_bs.php';
		include_once '../classes/hocvien_bs.php';
		include_once '../classes/phonghoc_bs.php';
		include_once '../classes/hopdong_bs.php';
		include_once '../classes/giaovien_bs.php';
		
		$LopHoc = new lophoc_bs();
		$LopHoc->SetMaLopHoc($MaLopHoc);
		$DLopHoc = $LopHoc->LayDanhSach();
		
		$HocVien = new hocvien_bs();
		$HocVien->SetMaLopHoc($MaLopHoc);
		$DHocVien = $HocVien->LayDanhSach();
		$SoHocVien = $DHocVien == null ? 0 : count($DHocVien);
		
		$PhongHoc = new phonghoc_bs();
		$PhongHoc->SetMaPhong($DLopHoc[0]['MaPhong']);
		$DPhongHoc = $PhongHoc->LayDanhSach();
		$SoLuongToiDa = $DPhongHoc == null ? 0 : $DPhongHoc[0]['SoMayHoatDong'];
		
		$TenPhongHoc = $DPhongHoc == null ? 'Chưa xếp' : $DPhongHoc[0]['MaPhong'];
		
		$HopDong = new hopdong_bs();
		$HopDong->SetMaLopHoc($DLopHoc[0]['MaLopHoc']);
		$HopDong->SetMaVaiTro('VG01');
		$DHopDong = $HopDong->LayDanhSach();
		
		$HoTenGiaoVien = '<i>Chưa phân công</i>';
		if($DHopDong != null)
		{
			$GiaoVien = new giaovien_bs();
			$GiaoVien->SetMaGiaoVien($DHopDong[0]['MaGiaoVien']);
			$DGiaoVien = $GiaoVien->LayDanhSach();
			$HoTenGiaoVien = $DGiaoVien[0]['HoTen'];
		}
?>
<table width="100%" style="border-spacing: 0; border: 1px solid #f1f1f1;">
	<tr>
		<th colspan="2" style="background-color: #f1f1f1;">THÔNG TIN LỚP ĐƯỢC CHỌN</th>
	</tr>	
	<tr>
		<td>Số học viên: </td><td> <?php echo $SoHocVien; ?></td>
	</tr>	
	<tr>
		<td>Số HV tối đa: </td><td> <?php echo $SoLuongToiDa; ?></td>
	</tr>	
	<tr>
		<td>Chỗ trống: </td><td><b> <?php echo $SoLuongToiDa - $SoHocVien; ?></b></td>
	</tr>	
	<tr>
		<td>Giáo viên: </td><td> <?php echo $HoTenGiaoVien; ?></td>
	</tr>	
	<tr>
		<td>Phòng học: </td><td> <?php echo $TenPhongHoc; ?></td>
	</tr>
</table>
<?php
	}
?>